﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WinnerCMS.Common;

namespace System
{
    /// <summary>
    /// 日期类扩展
    /// </summary>
    public static class DateTimeExtension
    {
        public static bool IsEmpty(this DateTime value)
        {
            return value == DateTime.MinValue;
        }

        public static bool IsEmpty(this DateTime? value)
        {
            if (value != null)
                return ((DateTime)value).IsEmpty();

            return false;
        }
        /// <summary>
        /// 时间差，默认相差选项为天
        /// </summary>
        /// <param name="value"></param>
        /// <param name="EndDate"></param>
        /// <param name="Interval"></param>
        /// <returns></returns>
        public static double DateDiff(this DateTime? value, DateTime? EndDate, DateDiffOption Interval = DateDiffOption.Day)
        {
            return MyDateTime.DateDiff(Interval, value, EndDate);
        }
    }
}
